from flask_script import Manager
from blog import create_app
from base import db
from flask_migrate import Migrate, MigrateCommand

app = create_app()
# Init manager object via app object
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    import unittest
    tests = unittest.TestLoader().discover('blog.appone.test')
    unittest.TextTestRunner(verbosity=2).run(tests)

if __name__ == '__main__':
    manager.run()
